<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>糖尿病视网膜病变检测系统</title>
    <!-- Bootstrap CSS -->
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet">
    <!-- Font Awesome -->
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css">
    <style>
        /* 自定义样式 */
        body {
            background-color: #f8f9fa;
            font-family: "Microsoft YaHei", "SimHei", sans-serif;
        }
        .navbar {
            background-color: #343a40;
        }
        .navbar-brand {
            font-weight: bold;
            font-size: 1.5rem;
        }
        .nav-link {
            color: #fff !important;
            transition: all 0.3s ease;
        }
        .nav-link:hover {
            color: #f8f9fa !important;
            background-color: #495057;
            border-radius: 4px;
        }
        .card {
            border: none;
            border-radius: 8px;
            box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
            transition: transform 0.3s ease, box-shadow 0.3s ease;
        }
        .card:hover {
            transform: translateY(-5px);
            box-shadow: 0 8px 15px rgba(0, 0, 0, 0.1);
        }
        .btn-primary {
            background-color: #007bff;
            border-color: #007bff;
        }
        .btn-primary:hover {
            background-color: #0056b3;
            border-color: #0056b3;
        }
        .feature-icon {
            font-size: 2rem;
            color: #007bff;
            margin-bottom: 1rem;
        }
        .hero-section {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            color: white;
            padding: 6rem 0;
            margin-bottom: 3rem;
        }
        .hero-section h1 {
            font-size: 3rem;
            font-weight: bold;
            margin-bottom: 1rem;
        }
        .hero-section p {
            font-size: 1.25rem;
            opacity: 0.9;
        }
        .content-section {
            padding: 2rem 0;
        }
        .content-section h2 {
            color: #343a40;
            margin-bottom: 2rem;
            position: relative;
            padding-bottom: 0.5rem;
        }
        .content-section h2::after {
            content: '';
            position: absolute;
            bottom: 0;
            left: 0;
            width: 60px;
            height: 4px;
            background-color: #007bff;
            border-radius: 2px;
        }
        .footer {
            background-color: #343a40;
            color: #fff;
            padding: 2rem 0;
            margin-top: 3rem;
        }
        .footer a {
            color: #f8f9fa;
            text-decoration: none;
        }
        .footer a:hover {
            color: #007bff;
        }
        .prevention-card {
            border-left: 4px solid #007bff;
            padding-left: 1rem;
            margin-bottom: 1.5rem;
        }
        .prevention-card h4 {
            color: #007bff;
            margin-bottom: 0.5rem;
        }
        /* 预测结果样式 */
        .result-container {
            display: none;
            margin-top: 2rem;
            padding: 1.5rem;
            border-radius: 8px;
        }
        .result-positive {
            background-color: #fff3cd;
            border: 1px solid #ffeaa7;
            color: #856404;
        }
        .result-negative {
            background-color: #d4edda;
            border: 1px solid #c3e6cb;
            color: #155724;
        }
        .result-icon {
            font-size: 3rem;
            margin-bottom: 1rem;
        }
        /* 加载动画 */
        .loading-spinner {
            display: none;
            width: 40px;
            height: 40px;
            border: 4px solid #f3f3f3;
            border-top: 4px solid #007bff;
            border-radius: 50%;
            animation: spin 1s linear infinite;
            margin: 1rem auto;
        }
        @keyframes spin {
            0% { transform: rotate(0deg); }
            100% { transform: rotate(360deg); }
        }
        /* 图片上传和摄像头捕获样式 */
        .image-container {
            position: relative;
            margin: 1rem 0;
        }
        #preview-image {
            max-width: 100%;
            max-height: 400px;
            display: none;
            border-radius: 8px;
            box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
        }
        #video {
            max-width: 100%;
            max-height: 400px;
            display: none;
            border-radius: 8px;
            box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
        }
        .camera-controls {
            margin-top: 1rem;
            display: none;
        }
    </style>
</head>
<body>
    <!-- 导航栏 -->
        <nav class="navbar navbar-expand-lg navbar-dark">
            <div class="container">
                <a class="navbar-brand" href="/"><i class="fas fa-eye"></i> 糖尿病视网膜病变检测系统</a>
                <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
                    <span class="navbar-toggler-icon"></span>
                </button>
                <div class="collapse navbar-collapse" id="navbarNav">
                    <ul class="navbar-nav ml-auto">
                        <li class="nav-item active">
                            <a class="nav-link" href="/">首页</a>
                        </li>
                        <li class="nav-item">
                            <a class="nav-link" href="/history">检测记录</a>
                        </li>
                        <li class="nav-item">
                            <a class="nav-link" href="/about">关于糖尿病</a>
                        </li>
                        <li class="nav-item">
                            <a class="nav-link" href="/dangers">糖尿病危害</a>
                        </li>
                        <li class="nav-item">
                            <a class="nav-link" href="/prevention">预防措施</a>
                        </li>
                    </ul>
                </div>
            </div>
        </nav>

    <!-- 主内容 -->
    <main class="container">
        <!-- Flash消息 -->
        {% with messages = get_flashed_messages(with_categories=true) %}
            {% if messages %}
                {% for category, message in messages %}
                    <div class="alert alert-{{ category if category != 'message' else 'info' }} alert-dismissible fade show mt-4" role="alert">
                        {{ message }}
                        <button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
                    </div>
                {% endfor %}
            {% endif %}
        {% endwith %}
        
        {% block content %}
        <!-- 各页面内容将在这里呈现 -->
        {% endblock %}
    </main>

    <!-- 页脚 -->
    <footer class="footer">
        <div class="container">
            <div class="row">
                <div class="col-md-6">
                    <h3><i class="fas fa-eye"></i> 糖尿病视网膜病变检测系统</h3>
                    <p>本系统旨在帮助早期发现糖尿病视网膜病变，提高人们对糖尿病的认识和预防意识。</p>
                </div>
                <div class="col-md-6">
                    <h3>快速链接</h3>
                    <ul class="list-unstyled">
                        <li><a href="/">首页</a></li>
                        <li><a href="/about">关于糖尿病</a></li>
                        <li><a href="/dangers">糖尿病危害</a></li>
                        <li><a href="/prevention">预防措施</a></li>
                        <li><a href="/history">检测记录</a></li>
                    </ul>
                </div>
            </div>
            <div class="mt-4 text-center">
                <p>&copy; 2025/9/4 糖尿病视网膜病变检测系统.</p>
            </div>
        </div>
    </footer>

    <!-- jQuery, Popper.js, Bootstrap JS -->
    <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
    <script src="https://cdn.jsdelivr.net/npm/@popperjs/core@2.10.2/dist/umd/popper.min.js"></script>
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.min.js"></script>

    <!-- 自定义JavaScript -->
    {% block scripts %}
    <!-- 页面特定的脚本将在这里添加 -->
    {% endblock %}
</body>
</html>